<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>
<jsp:include page="/schedule/util.jsp"></jsp:include>	
<html>
  <body bgcolor="#94D2E0">
  <script type="text/javascript">
 Ext.onReady(function(){
 	 Ext.QuickTips.init();
   	 Ext.form.Field.prototype.msgTarget='under';
	 Ext.apply(Ext.form.VTypes,{
	        password:function(val,field)
	           {               
	            if(field.confirmTo)
	                  {              
           			 	var pwd=Ext.get(field.confirmTo);
             			 		return (val==pwd.getValue());
	                  		}
	　　             		 return true;
	        	 }
	　	　});
	  if('${teachers}'!= ""){
				var teachersform= new Ext.form.FormPanel({
								region:'center',
								frame : true,
								layout : "form", // 整个大的表单是form布局
								labelWidth : 65,
								labelAlign : "right",
								maximizable:true,
								items : [{ // 行1
									layout : "column", // 从左往右的布局
									items : [{
										columnWidth : .8,
										layout : "form",
										items : [{
											xtype : "textfield",
											readOnly:true,
											value:'${teachers.teachers_name}' ,
											allowBlank : false,
											name:"teachers.teachers_name",
											fieldLabel : "用户姓名",
											blankText: '必须填写',
											width : 120
										}]
									},{
										xtype : 'hidden',
										name:"teachers.teachers_systems.systems_id",
										value: '${teachers.teachers_systems.systems_id}',
										allowBlank : false
									},{
										xtype : 'hidden',
										name:"teachers.teachers_zhichen",
										value: '${teachers.teachers_zhichen}',
										allowBlank : false
									},
									{
										xtype : 'hidden',
										name:"teachers.teachers_sysFlag",
										value: '${teachers.teachers_sysFlag}',
										allowBlank : false
									},{
										xtype : 'hidden',
										name:"teachers.teachers_code",
										value: '${teachers.teachers_code}',
										allowBlank : false
									},{
										xtype : "hidden",//隐藏的教室Id
										name:"teachers.teachers_id",
										value: '${teachers.teachers_id}',
										allowBlank : false
										},
									{
										columnWidth : .8,
										layout : "form",
										items : [{
										xtype : "textfield",
										inputType : 'password',
										id:"pass0",
										allowBlank : false,
										blankText: '必须填写',
										fieldLabel : "原有密码",
										width : 120
										}]
									},{
										columnWidth : .8,
										layout : "form",
										items : [{
										xtype : "textfield",
										inputType : 'password',
										allowBlank : false,
										blankText: '必须填写',
										id:"pass1",
										name:"teachers.teachers_password",
										fieldLabel : "新密码",
										width : 120
										}]
									},{
										columnWidth : .8,
										layout : "form",
										items : [{
										xtype : "textfield",
										inputType : 'password',
										allowBlank : false,
										id:"pass2",
										blankText: '必须填写',
										vtype:"password",//自定义的验证类型
								        vtypeText:"两次密码不一致！",
								　　          confirmTo:"pass1",//要比较的另外一个的组件的id
										name:"teachers.teachers_password",
										fieldLabel : "确认密码",
										width : 120
										}]
									}]
								},{//行8
								buttonAlign : "right",
								buttons : [{
								text : "修改",
								handler:function(){
									if (teachersform.form.isValid()){ 
											teachersform.form.submit({
											waitTitle : '请稍候',
											waitMsg : '正在保存......',
											url :'/schedule/addTeachers',
											method:"POST",
											success : function(form, action) {
												Ext.Msg.alert("系统消息", action.result.msg, function() {
												win.close();
												window.parent.location.reload('<%=path%>/teachers/index.jsp')
											}, this);
											},
											failure : function(form, action) {
												Ext.Msg.alert('系统消息', action.result.msg);
												win.close();
												window.parent.location.reload('<%=path%>/teachers/index.jsp')
											}
											})
								
										}
									}
								}, {
								text : "重置",
									listeners :{click:function(){teachersform.form.reset()}}
								}]
								}]
							});
							var win = new Ext.Window({
								layout:'fit',
								title:'用户信息',
								width:280,
								height:200,
								resizable:false,
								closeAction:'close',
								plain: true,
								items:teachersform,
								listeners: {
										close:function(win){
											//关键部分：关闭窗口前先还原,滚动条才不会消失
											win.restore();
										},
										maximize:function(win){
										}
								}
						});
						win.show();
				}
	  	 	else{
					 Ext.MessageBox.alert(
							"系统提示",
							"你还未登陆，现在就去登陆？",
							function(button) {
					 			 	window.parent.location.reload('<%=path%>/schedule/loginInfo.jsp');
						});
				}
  });
  
  
  </script>
  <div id="foot" align="right" ></div> 
  <div id="tool" style="text-align: right;position: relative; right:0px; top: -30px"></div>
   <div style="text-align: right;position: relative; right:0px; top: -32px">
	 <img alt="" src="/schedule/images/mainframe.jpg" width="100%" height="100%">
  	</div>
  </body>
</html>
